package com.cysoft.opensource.okhttp;

import java.util.concurrent.TimeUnit;

import javax.net.ssl.SSLSession;

import okhttp3.OkHttpClient;

public class OkHttpUtil {
    private static OkHttpClient sOkHttpClient;
    private static final int TIME_OUT = 30;

    static {
        OkHttpClient.Builder okHttpBuilder = new OkHttpClient.Builder();
        okHttpBuilder.hostnameVerifier((String s, SSLSession sslSession)-> true);
        okHttpBuilder.connectTimeout(TIME_OUT, TimeUnit.SECONDS);
        okHttpBuilder.readTimeout(TIME_OUT, TimeUnit.SECONDS);
        okHttpBuilder.writeTimeout(TIME_OUT, TimeUnit.SECONDS);
        okHttpBuilder.followRedirects(true);
        sOkHttpClient = okHttpBuilder.build();
    }

}
